<?php
class AuthController extends \BaseController
{
	public function getIndex()
	{
		return View::make('auth');
		// Fuck Jade man. She's a bitch.
		// return Jade::render('auth');
	}
	
	public function postIndex()
	{
		$credentials	= ['email' => \Input::get('email'), 'password' => \Input::get('password')];
		$remember		= (bool)\Input::get('remember');
		
		if(Auth::attempt($credentials, $remember))
			return Redirect::intended('/');
		
		$error			= 'Sign in failed. Incorrect credentials.';
		return Redirect::back()->withErrors(['error' => $error]);
	}
	
	public function getLogout()
	{
		Auth::logout();
		return Redirect::to('/');
	}
}